package com.kuaiyin.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.Map;

@Data
@Schema(name = "RequestDTO", description = "创建请求参数")
public class RequestDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;


    @Schema(description = "请求ID（更新时必填，创建时无需填）")
    private Long id;


    @Schema(description = "请求名称（唯一）", example = "查询用户接口", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "请求名称不能为空")
    @Size(max = 64, message = "请求名称长度不能超过64字符")
    private String name;

    @Schema(
            description = "接口路径（支持动态模板）",
            example = "{{baseurl}}/api/v1/users/",
            requiredMode = Schema.RequiredMode.REQUIRED
    )
    @NotBlank(message = "接口路径不能为空")
    private String path;

    @Schema(
            description = "HTTP方法",
            example = "GET",
            allowableValues = {"GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"},
            requiredMode = Schema.RequiredMode.REQUIRED
    )
    @NotBlank(message = "HTTP方法不能为空")
    private String method;

    @Schema(description = "请求头（JSON格式）")
    private Map<String, Object> headers;

    @Schema(description = "查询参数（JSON格式）")
    private Map<String, Object> params;

    @Schema(description = "请求体（JSON格式）")
    private Map<String, Object> body;

    @Schema(description = "接口描述", example = "用户相关接口定义")
    @Size(max = 500, message = "描述长度不能超过500字符")
    private String description;

}